package com.example.administrator.twopagelibrary.view.activity;


import android.view.View;


import com.alibaba.android.arouter.facade.annotation.Route;
import com.example.administrator.commonlibrary.bean.MyBean;
import com.example.administrator.commonlibrary.contract.activity.MaiAcivityContract;
import com.example.administrator.commonlibrary.utils.ActivityUtils;
import com.example.administrator.commonlibrary.utils.ToastUtils;
import com.example.administrator.commonlibrary.utils.arouter.ARouterUtils;
import com.example.administrator.commonlibrary.utils.arouter.HelloService;
import com.example.administrator.twopagelibrary.R;
import com.example.administrator.twopagelibrary.R2;
import com.example.administrator.twopagelibrary.presenter.activity.MaiActivityPresenter;
import com.example.administrator.twopagelibrary.twobase.TwoBaseViewActivity;

import javax.inject.Inject;

import butterknife.OnClick;
import io.reactivex.functions.Consumer;

@Route(path = "/two/mintent")
public class MIntentActivity extends TwoBaseViewActivity<MaiAcivityContract.Presenter> implements MaiAcivityContract.View {

    @Inject
    MaiActivityPresenter presenter;

    @Override
    protected int onLayout() {
        return R.layout.two_activity_mintent;
    }

    @Override
    protected String setPageTitle() {
        return "mintent";
    }

    @Override
    protected MaiAcivityContract.Presenter initPresenter() {
        return presenter;
    }

    @Override
    protected void myOnCreate() {

    }


    @OnClick({R2.id.arouter, R2.id.arouter2})
    public void onViewClicked(View view) {
        int id = view.getId();
        if (id == R.id.arouter) {
            ARouterUtils.notifyDataChange(HelloService.class).sayHello("dfd");
        } else if (id == R.id.arouter2) {
            ActivityUtils.startActivityAnim(this, MIntent2Activity.class);
        }
    }


    @Override
    public Consumer addSubscription() {
        return new Consumer() {
            @Override
            public void accept(Object o) throws Exception {
                if (o instanceof MyBean) {
                    ToastUtils.bugToast("o--o");
                }
            }
        };
    }
}
